* Technology Use and Norm Change in Online Privacy: Experimental Evidence from Vignette Studies
* Paper submitted to Information, Communication & Society
* Last update: July 26, 2019

clear 
version 13.1 
set more off 
capture log close

*****************************************************************************

*** Study 1

use privacy_prolific

* Sociodemographic characteristics of participants
su sex, d
su age, d
replace age = . if age ==228
su age, d
tab educ 
tab race 
tab polid 

* Table 3 (main part)
* Means and sd of mediator and outcome variables across conditions
gen trt = 1 if trt1==1 & trt2==1
replace trt = 2 if trt1==2 & trt2==1
replace trt = 3 if trt1==1 & trt2==2
replace trt = 4 if trt1==2 & trt2==2
lab var trt "Experimental conditions"
lab def trt 1 "unpop. & rare" 2 "popular & rare" 3 "unpop. & freq." 4 "popular & freq."
lab val trt trt
tabstat aprv invas twty wling, by(trt) s(n mean sd)

* Testing hypotheses

* Table A5 (online appendix)
* Regression models for normative, behavioral and trustworthiness expectations
* Model 1
reg aprv ib1.trt1 ib1.trt2, robust
est save tables/prvp_m1, replace
* Model 2
reg invas ib1.trt1 ib1.trt2, robust
est save tables/prvp_m2, replace
reg invas ib1.trt1##ib1.trt2, robust
* If popularity is high, the effect of privacy inavsions on behavioral 
* expectations is insignificant.
lincom 2.trt2 + 2.trt1#2.trt2
* Model 3
reg twty ib1.trt1 ib1.trt2, robust
est save tables/prvp_m3, replace

est use tables/prvp_m1
eret di
eret li
est sto m1
est use tables/prvp_m2
eret di
eret li
est sto m2
est use tables/prvp_m3
eret di
eret li
est sto m3
qui: esttab m1 m2 m3 using tables/prvp_table4.rtf, ///
b(%9.3f) se(%9.3f) sfmt(%9.2f) ar2(%9.2f) starl(* 0.05 ** 0.01 *** 0.001) ///
title(Table 4: Regression models of normative, behavioral and trustworthiness expectations) ///
mti("M1" "M2" "M3") compress nogaps nonum replace

* Table A6 (online appendix)
* Regression models for willingness to use app 
* Model 4
reg wling ib1.trt1 ib1.trt2, robust
est save tables/prvp_m4, replace
* Model 5
reg wling ib1.trt1 ib1.trt2 aprv, robust
est save tables/prvp_m5, replace
* Model 6
reg wling ib1.trt1 ib1.trt2 invas, robust
est save tables/prvp_m6, replace
* Model 7
reg wling ib1.trt1 ib1.trt2 twty, robust
est save tables/prvp_m7, replace
* Model 8
reg wling ib1.trt1 ib1.trt2 aprv invas twty, robust
est save tables/prvp_m8, replace

est use tables/prvp_m4
eret di
eret li
est sto m4
est use tables/prvp_m5
eret di
eret li
est sto m5
est use tables/prvp_m6
eret di
eret li
est sto m6
est use tables/prvp_m7
eret di
eret li
est sto m7
est use tables/prvp_m8
eret di
eret li
est sto m8
qui: esttab m4 m5 m6 m7 m8 using tables/prvp_table5.rtf, ///
b(%9.3f) se(%9.3f) sfmt(%9.2f) ar2(%9.2f) starl(* 0.05 ** 0.01 *** 0.001) ///
title(Table 5: Regression models of willingness to use app) ///
mti("M4" "M5" "M6" "M7" "M8") compress nogaps nonum replace

*** 

* Make dummy variables (0/1)
gen trta = trt1 - 1
gen trtb = trt2 - 1

* Table A1 (online appendix)
* Zero-order correlations
* a) Pearson’s correlation coefficients
pwcorr trta trtb aprv invas twty wling, sig list obs
* b) Tetrachoric correlations 
tetrachoric trta trtb
* c) Point-biserial correlations 
* With popularity
pbis trta aprv
pbis trta invas
pbis trta twty
pbis trta wling
* With freq. invasions
pbis trtb aprv
pbis trtb invas
pbis trtb twty
pbis trtb wling

* Figure 2 (main part) and Table A2 (online appendix)
* SEM estimation of direct, indirect and total effects 
sem (wling <- trta trtb aprv invas twty) ///
	(aprv <- trta trtb) ///
	(invas <- trta trtb) ///
    (twty <- trta trtb) ///
    , vce(bootstrap, reps(5000))
est save tables/prvp_sem, replace
estat teffects, stand

* SEM estimation of theoretical model only
* (results hardly change)
/*
sem (wling <- aprv invas twty) ///
	(aprv <- trta) ///
	(invas <- trtb) ///
    (twty <- trta trtb) ///
    , vce(bootstrap, reps(5000))
estat teffects, stand
*/

* Table A9 (online appendix)
* Means and sd of sociodemographic variables across conditions
gen race2 = (race - 2)*(-1)
tabstat sex age educ race2 polid, by(trt) s(n mean sd)

* Not reported
* Main results are robust when controling for sociodemographic vars
reg aprv ib1.trt1 ib1.trt2 sex age educ race2 polid, robust
reg invas ib1.trt1 ib1.trt2 sex age educ race2 polid, robust
reg twty ib1.trt1 ib1.trt2 sex age educ race2 polid, robust
reg wling ib1.trt1 ib1.trt2 aprv invas twty sex age educ race2 polid, robust

*****************************************************************************

clear all
set maxvar 5100

*** Study 2

use privacy_yougov

* Sociodemographic characteristics of participants
su sex, d
su age, d
tab educ 
tab race 
tab polid 

* Create treatment variables
tab trt
gen trt1 = 1 if trt==1 | trt==3
replace trt1 = 2 if trt==2 | trt==4
lab var trt1 "App popularity"
lab def trt1 1"unpopular" 2"popular"
lab val trt1 trt1
tab trt1

tab trt
gen trt2 = 1 if trt==3 | trt==4
replace trt2 = 2 if trt==1 | trt==2
lab var trt2 "Privacy invasion"
lab def trt2 1"rare" 2"frequent"
lab val trt2 trt2

* Table 4 (main part)
* Means and sd of mediator and outcome variables across conditions
drop trt
gen trt = 1 if trt1==1 & trt2==1
replace trt = 2 if trt1==2 & trt2==1
replace trt = 3 if trt1==1 & trt2==2
replace trt = 4 if trt1==2 & trt2==2
lab var trt "Experimental conditions"
lab def trt 1 "unpop. & rare" 2 "popular & rare" 3 "unpop. & freq." 4 "popular & freq."
lab val trt trt
tabstat aprv invas twty wling, by(trt) s(n mean sd)

* Testing hypotheses

* Table A7 (online appendix)
* Regression models of normative, behavioral and trustworthiness expectations
* Model 1
reg aprv ib1.trt1 ib1.trt2 [pweight = weight]
est save tables/prvy_m1, replace
* Model 2
reg invas ib1.trt1 ib1.trt2 [pweight = weight]
est save tables/prvy_m2, replace
* Model 3
reg twty ib1.trt1 ib1.trt2 [pweight = weight]
est save tables/prvy_m3, replace

est use tables/prvy_m1
eret di
eret li
est sto m1
est use tables/prvy_m2
eret di
eret li
est sto m2
est use tables/prvy_m3
eret di
eret li
est sto m3
qui: esttab m1 m2 m3 using tables/prvy_table7.rtf, ///
b(%9.3f) se(%9.3f) sfmt(%9.2f) ar2(%9.2f) starl(* 0.05 ** 0.01 *** 0.001) ///
title(Table 7: Regression models of normative, behavioral and trustworthiness expectations) ///
mti("M1" "M2" "M3") compress nogaps nonum replace

* Table A8 (online appendix)
* Regression models of willingness to use app
* Model 4
reg wling ib1.trt1 ib1.trt2 [pweight = weight]
est save tables/prvy_m4, replace
* Model 5
reg wling ib1.trt1 ib1.trt2 aprv [pweight = weight]
est save tables/prvy_m5, replace
* Model 6
reg wling ib1.trt1 ib1.trt2 invas [pweight = weight]
est save tables/prvy_m6, replace
* Model 7
reg wling ib1.trt1 ib1.trt2 twty [pweight = weight]
est save tables/prvy_m7, replace
* Model 8
reg wling ib1.trt1 ib1.trt2 aprv invas twty [pweight = weight]
est save tables/prvy_m8, replace

est use tables/prvy_m4
eret di
eret li
est sto m4
est use tables/prvy_m5
eret di
eret li
est sto m5
est use tables/prvy_m6
eret di
eret li
est sto m6
est use tables/prvy_m7
eret di
eret li
est sto m7
est use tables/prvy_m8
eret di
eret li
est sto m8
qui: esttab m4 m5 m6 m7 m8 using tables/prvy_table8.rtf, ///
b(%9.3f) se(%9.3f) sfmt(%9.2f) ar2(%9.2f) starl(* 0.05 ** 0.01 *** 0.001) ///
title(Table 8: Regression models of willingness to use app) ///
mti("M4" "M5" "M6" "M7" "M8") compress nogaps nonum replace

*** 

* Make dummy variables (0/1)
gen trta = trt1 - 1
gen trtb = trt2 - 1

* Table A3 (online appendix)
* Zero-order correlations
* a) Pearson’s correlation coefficients
pwcorr trta trtb aprv invas twty wling, sig list obs
* b) Tetrachoric correlations 
tetrachoric trta trtb
* c) Point-biserial correlations 
* With popularity
pbis trta aprv
pbis trta invas
pbis trta twty
pbis trta wling
* With freq. invasions
pbis trtb aprv
pbis trtb invas
pbis trtb twty
pbis trtb wling

* Figure 3 (main part) and Table A4 (online appendix)
* SEM estimation of direct, indirect and total effects 
generate byte _one = 1
svyset _n [pweight=weight], strata(_one)
bsweights bw, n(200) reps(5000) seed(10101) dots
bs4rw, rw(bw*): sem (wling <- trta trtb aprv invas twty) ///
				(aprv <- trta trtb) ///
				(invas <- trta trtb) ///
				(twty <- trta trtb) [pweight=weight]
est save tables/prvp_sem2, replace
estat teffects, stand

* SEM estimation of theoretical model only
* (results hardly change)
/*
bs4rw, rw(bw*): sem (wling <- aprv invas twty) ///
				(aprv <- trta) ///
				(invas <- trtb) ///
				(twty <- trta trtb) [pweight=weight]
estat teffects, stand
*/

* Table A10 (online appendix)
* Means and sd of sociodemographic variables across conditions
gen race2 = race == 1
tabstat sex age educ race2 polid, by(trt) s(n mean sd)

* Not reported
* Main results are robust when controling for sociodemographic vars
reg aprv ib1.trt1 ib1.trt2 sex age educ race2 polid [pweight = weight]
reg invas ib1.trt1 ib1.trt2 sex age educ race2 polid [pweight = weight]
reg twty ib1.trt1 ib1.trt2 sex age educ race2 polid [pweight = weight]
reg wling ib1.trt1 ib1.trt2 aprv invas twty sex age educ race2 polid [pweight = weight]

* Exploratory analyses
gen female = sex == 1
gen coldeg = educ >= 4
gen rwhite = race == 1
gen rblack = race == 2
gen rhispa = race == 3
gen rother = race > 3
gen married = marstat==1
gen unemp = employ == 4
corr closti biconf lppriv
gen clostir = 5 - closti
corr clostir biconf lppriv
alpha clostir biconf lppriv, i s
alpha biconf lppriv, i s
* Privacy protect variable
gen privi = (biconf + lppriv) / 2
* Check whether privacy attitudes are affected by experimental conditions
reg privi ib1.trt1 ib1.trt2 [pweight = weight]
reg closti ib1.trt1 ib1.trt2 [pweight = weight]

* Table A11 (online appendix)
* OLS regression models including sociodemographic characteristics
* Model 1
reg aprv privi closti age ib0.female ib0.rblack ib0.rhispa ib0.rother ib0.married ///
polid ib0.coldeg ib0.unemp ib1.trt1 ib1.trt2 [pweight = weight]
est save tables/prvy_explo_m1, replace
* Model 2
reg invas privi closti age ib0.female ib0.rblack ib0.rhispa ib0.rother ib0.married ///
polid ib0.coldeg ib0.unemp ib1.trt1 ib1.trt2 [pweight = weight]
est save tables/prvy_explo_m2, replace
* Model 3
reg twty privi closti age ib0.female ib0.rblack ib0.rhispa ib0.rother ib0.married ///
polid ib0.coldeg ib0.unemp ib1.trt1 ib1.trt2 [pweight = weight]
est save tables/prvy_explo_m3, replace
* Model 4
reg wling aprv invas twty age ib0.female ib0.rblack ib0.rhispa ib0.rother ib0.married ///
polid ib0.coldeg ib0.unemp ib1.trt1 ib1.trt2 [pweight = weight]
est save tables/prvy_explo_m4, replace
* Model 5
reg wling aprv invas twty privi closti age ib0.female ib0.rblack ib0.rhispa ib0.rother ib0.married ///
polid ib0.coldeg ib0.unemp ib1.trt1 ib1.trt2 [pweight = weight]
est save tables/prvy_explo_m5, replace

est use tables/prvy_explo_m1
eret di
eret li
est sto m1
est use tables/prvy_explo_m2
eret di
eret li
est sto m2
est use tables/prvy_explo_m3
eret di
eret li
est sto m3
est use tables/prvy_explo_m4
eret di
eret li
est sto m4
est use tables/prvy_explo_m5
eret di
eret li
est sto m5
qui: esttab m1 m2 m3 m4 m5 using tables/prvy_tableA7.rtf, ///
b(%9.3f) se(%9.3f) sfmt(%9.2f) ar2(%9.2f) starl(* 0.05 ** 0.01 *** 0.001) ///
title(Table A7: OLS regression models including sociodemographic characteristics) ///
mti("M1" "M2" "M3" "M4" "M5") compress nogaps nonum replace

* EOF
